package com.mfrs;

import android.os.Parcel;
import android.os.Parcelable;

public final class BmpData implements Parcelable
{
	private int byteLength = 0;	
	private byte[] data;
		
	public static final Creator<BmpData> CREATOR = new Creator<BmpData>() {

		@Override
		public BmpData createFromParcel(Parcel in) {
			return new BmpData(in);		
			}

		@Override
		public BmpData[] newArray(int size) {
			return new BmpData[size];
		}		
	};
	
	public BmpData()
	{

	}
	
	public BmpData(Parcel in){
		readFromParcel(in);
	}
	
	public void readFromParcel(Parcel in) {        	
    	byteLength = in.readInt();
    	data = new byte[byteLength];
    	in.readByteArray(data);
    }    
    
	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel outParcel, int flags) {
		outParcel.writeInt(byteLength);
		outParcel.writeByteArray(data);		
	}
	
	public int getLength(){
		return byteLength;
	}

	public byte[] getData() {
		return data;
	}

	public void setData(byte[] data) {
		this.data = data;
		this.byteLength = data.length;
	}
	
}